<?xml version='1.0' encoding='UTF-8' ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<ui:composition xmlns="http://www.w3.org/1999/xhtml"  
                xmlns:h="http://java.sun.com/jsf/html"  
                xmlns:f="http://java.sun.com/jsf/core"
                xmlns:p="http://primefaces.prime.com.tr/ui"
                xmlns:ui="http://java.sun.com/jsf/facelets"
                template="./../templates/FoodSageTemplate.xhtml">

    <ui:define name="logout">
        <p:commandLink id="logoutLink" actionListener="#{touristLogoutManagedBean.doLogout}" value="#{bundle['login.logout.label']}" ajax="false" immediate="true" />
    </ui:define>

    <ui:define name="main_menu">
        <f:view beforePhase="#{itineraryChooseItineraryTypeManagedBean.initView}"/>
        <p:menubar model="#{itineraryChooseItineraryTypeManagedBean.touristMainMenuModel}"/>
    </ui:define>

    <ui:define name="nav_menu">
        <p:menu model="#{itineraryChooseItineraryTypeManagedBean.touristNavMenuModel}"/>
    </ui:define>

    <ui:define name="content">
        <h:form id="form1">
            <p:growl id="growl" showDetail="true" />
            <br/>
            <br/>
            <p:fieldset style="position:relative; width:950px">
                <h2>VIEW ALL GROUPON PURCHASES</h2>
                <br/>
                <p:dataTable var="purchasedGroupon" value="#{grouponManagerBean.tCubeOfferedGrouponList}" paginator="true" 
                             rows="10" emptyMessage="No groupon has been offered" selection="#{grouponManagerBean.selectedGroupon}" 
                             selectionMode="single" rowSelectListener="#{grouponManagerBean.onRowTCubeSelectNavigateGroupon}"
                             dblClickSelect="true">

                    <p:column sortBy="#{offeredGroupon.id}" filterBy="#{offeredGroupon.id}">
                        <f:facet name="header">
                            <h:outputText value="ID" />
                        </f:facet>
                        <h:outputText value="#{offeredGroupon.id}" />
                    </p:column>

                    <p:column sortBy="#{offeredGroupon.stakeholder.corpName}" filterBy="#{offeredGroupon.stakeholder.corpName}">
                        <f:facet name="header">
                            <h:outputText value="Company name" />
                        </f:facet>
                        <h:outputText value="#{offeredGroupon.stakeholder.corpName}" />
                    </p:column>

                    <p:column sortBy="#{offeredGroupon.name}" filterBy="#{offeredGroupon.name}">
                        <f:facet name="header">
                            <h:outputText value="Name" />
                        </f:facet>
                        <h:outputText value="#{offeredGroupon.name}" />
                    </p:column>

                    <p:column>
                        <f:facet name="header">
                            <h:outputText value="Image" />
                        </f:facet>
                        <p:graphicImage id="imageDisplay" value="/images/groupons/#{offeredGroupon.imageURL}"
                                        height="50" width="50"/> 
                    </p:column>

                    <p:column sortBy="#{offeredGroupon.offeredPrice}" filterBy="#{offeredGroupon.offeredPrice}">
                        <f:facet name="header">
                            <h:outputText value="Offered Price" />
                        </f:facet>
                        <h:outputText value="#{offeredGroupon.offeredPrice}" />
                    </p:column>

                    <p:column sortBy="#{offeredGroupon.minimumIssuedQuantity}" filterBy="#{offeredGroupon.minimumIssuedQuantity}">
                        <f:facet name="header">
                            <h:outputText value="Minimum Quantity" />
                        </f:facet>
                        <h:outputText value="#{offeredGroupon.minimumIssuedQuantity}" />
                    </p:column>

                    <p:column sortBy="#{offeredGroupon.startDate}" filterBy="#{offeredGroupon.startDate}">
                        <f:facet name="header">
                            <h:outputText value="Start Date" />
                        </f:facet>
                        <h:outputText value="#{offeredGroupon.startDate}" />
                    </p:column>

                    <p:column sortBy="#{offeredGroupon.endDate}" filterBy="#{offeredGroupon.endDate}">
                        <f:facet name="header">
                            <h:outputText value="End Date" />
                        </f:facet>
                        <h:outputText value="#{offeredGroupon.endDate}" />
                    </p:column>

                    <p:column sortBy="#{offeredGroupon.status}" filterBy="#{offeredGroupon.status}">
                        <f:facet name="header">
                            <h:outputText value="Status" />
                        </f:facet>
                        <h:outputText value="#{offeredGroupon.status}" />
                    </p:column>
                </p:dataTable>
            </p:fieldset>
        </h:form>       
    </ui:define>
</ui:composition>